public class jj720 {
    public static int func(int n) {
        if (n == 1 || n == 2) {
            return 1;
        }
        return func(n - 1) + func(n - 2);
    }
    public static int fib(int n){
        if(n == 1 || n == 2){
            return 1;
        }
        int f1 = 1;
        int f2 = 1;
        int f3 = -1;
        for (int i = 3; i <= n ; i++) {
            f3 = f1 + f2;
            f1 = f2;
            f2 = f3;
        }
        return f3;



    }




    public static void main(String[] args) {
        System.out.println(func(5));
        System.out.println(fib(40));
    }



    public static int fun(int n) {
        if (n <= 9){
            return n;
        }

        return n % 10 + fun( n / 10 );
    }

    public static void main1(String[] args) {
        //System.out.println(fun(1729));
    }
    

}
